package ivan.cheng.upgrade;

public class UpgradeInfo
{
	
	public static final int ON_NEED_UPGRADE = 210;
	public static final int FORCE_TO_UPGRADE = 211;
	public static final int OPTIONAL_TO_UPGRADE = 212;
	public static final int SERVER_IS_BUSY = 500;
	public static final int INVALID_PARAM = 600;
	public static final int UNAVALABLE_APP_INFO_ON_SERVER = 804;
	
	/**本次服务器返回的是否需要升级的结果*/
	public int result;
	/**可获得的版本号*/
	public String available_version;
	/**文件长度（字节）*/
	public int length;
	/**循环冗余校验码*/
	public String crc;
	/**升级地址*/
	public String url;
	/**升级提示*/
	public String tip;
	/**由服务器配置的等待框提示语等*/
	public String waiting_infos;
	/**本次从服务器成功查看下来的时间*/
	public long last_check_time;
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((available_version == null) ? 0 : available_version
						.hashCode());
		result = prime * result + ((crc == null) ? 0 : crc.hashCode());
		result = prime * result
				+ (int) (last_check_time ^ (last_check_time >>> 32));
		result = prime * result + length;
		result = prime * result + this.result;
		result = prime * result + ((tip == null) ? 0 : tip.hashCode());
		result = prime * result + ((url == null) ? 0 : url.hashCode());
		result = prime * result
				+ ((waiting_infos == null) ? 0 : waiting_infos.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UpgradeInfo other = (UpgradeInfo) obj;
		if (available_version == null) {
			if (other.available_version != null)
				return false;
		} else if (!available_version.equals(other.available_version))
			return false;
		if (crc == null) {
			if (other.crc != null)
				return false;
		} else if (!crc.equals(other.crc))
			return false;
		if (last_check_time != other.last_check_time)
			return false;
		if (length != other.length)
			return false;
		if (result != other.result)
			return false;
		if (tip == null) {
			if (other.tip != null)
				return false;
		} else if (!tip.equals(other.tip))
			return false;
		if (url == null) {
			if (other.url != null)
				return false;
		} else if (!url.equals(other.url))
			return false;
		if (waiting_infos == null) {
			if (other.waiting_infos != null)
				return false;
		} else if (!waiting_infos.equals(other.waiting_infos))
			return false;
		return true;
	}
	
	
}
